package com.xmkj.carwash.mine.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.View;

import com.common.retrofit.entity.bean.WashCarRecordBean;
import com.common.widget.recyclerview.refresh.adapter.CommonAdapter;
import com.common.widget.recyclerview.refresh.adapter.ViewHolder;
import com.xmkj.carwash.R;
import com.xmkj.carwash.activity.OrderDetalRecordActivitiy;

import java.util.List;

/**
 * Created by chen on 2018/3/31.
 */

public class WashRecordAdapter extends CommonAdapter<WashCarRecordBean.ListsBean> {
    public WashRecordAdapter(Context context, List<WashCarRecordBean.ListsBean> data) {
        super(context, data);
    }

    @Override
    protected void convert(ViewHolder holder, final WashCarRecordBean.ListsBean item, int position) {
        holder.setText(R.id.tv_car_name,item.brand+" "+item.model+" "+item.carnum);
        holder.setText(R.id.tv_wash_money,item.total);
        holder.setText(R.id.tv_date,item.create_time);
        holder.getParentView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(mContext, OrderDetalRecordActivitiy.class);
                intent.putExtra(OrderDetalRecordActivitiy.ORDERID,item.id+"");
                mContext.startActivity(intent);
            }
        });
        switch (item.status){
            case 1:
                holder.setText(R.id.tv_stasus,"等待接单");
                break;
            case 2:
                holder.setText(R.id.tv_stasus,"在路上");
                break;
            case 3:
                holder.setText(R.id.tv_stasus,"洗车中");
                break;
            case 4:
                holder.setText(R.id.tv_stasus,"待支付");
                break;
            case 5:
                holder.setText(R.id.tv_stasus,"支付完成");
                break;
            case 6:
                holder.setText(R.id.tv_stasus,"交易成功");
                break;
            case 7:
                holder.setText(R.id.tv_stasus,"交易关闭");
                break;
        }
    }

    @Override
    protected int getItemViewLayoutId(int position, WashCarRecordBean.ListsBean item) {
        return R.layout.item_user_car_details;
    }
}
